'use strict';

app.controller('vizCtrl', ["$rootScope","$scope", "$state", "$timeout", "$interval", "$aside", "SweetAlert", "Restangular", "api_cmdb", function ($rootScope, $scope, $state, $timeout, $interval, $aside, SweetAlert, Restangular, api_cmdb) {
	
	// d3.select("#menu").selectAll('button')
 //    .data(['table','sphere', 'helix', 'grid']).enter()
 //      .append('button')
 //      .html(function (d) { return d; })
 //      .on('click', function (d) { VIZ.transform(d); });

    $scope.transform = function(d){
    	VIZ.transform(d);
    }
	
    angular.element("#d3container").append(VIZ.domEl);
	d3.json("assets/data/investments.json", function (error, data) {
        VIZ.drawElements(data);
        VIZ.transform('helix');
        d3.select("#loading").remove();
        VIZ.render();
        VIZ.animate();
        window.addEventListener('resize', VIZ.onWindowResize, false);
      });

}]);